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

Query time 0.00028