UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XXW7iiIgZgEMMaFhzcJF13NehjKjqkaqbXDdrcLeAKo=' 
WHERE 
  key_id = 'dc37d96477bd070c4ee2c5493dfb260265bca65f8d809c106bf8b99cd357259f' 
  AND (
    token = 'XXW7iiIgZgEMMaFhzcJF13NehjKjqkaqbXDdrcLeAKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017