UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E4IS8uNPsZX/kJjlqXUEoHpUKynO8TUooLyQHMEBwLk=' 
WHERE 
  key_id = '532451eff99b69d4e09f22e7affff6691b880732f5fe68c6848a91d1e22523c2' 
  AND (
    token = 'E4IS8uNPsZX/kJjlqXUEoHpUKynO8TUooLyQHMEBwLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036