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

Query time 0.00022