UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+raKTwIBT1NYpPORIpeePP4SAmf0qNFMkEgxFeZPww=' 
WHERE 
  key_id = '2bafc70e818447595a8c743b503790f29ebd385721941944f025042b6022ef6a' 
  AND (
    token = 'f+raKTwIBT1NYpPORIpeePP4SAmf0qNFMkEgxFeZPww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052