UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6BSBYm8xYTA1iTGV/8SShUpQUfmbkfKmEqvudaMJ1Y0=' 
WHERE 
  key_id = 'd4107f7683d7976201b85f9f1b7007e4ef2bf7111ebba01637be1beb3aafa640' 
  AND (
    token = '6BSBYm8xYTA1iTGV/8SShUpQUfmbkfKmEqvudaMJ1Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035