UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NpJIX6C+UKmV3GluCZvpUh77dZetKObutxSMw5YywAA=' 
WHERE 
  key_id = '2e49cd0262d9f850ddfc9dd6b820423636618bdb5b0cf291c38031879851d5e2' 
  AND (
    token = 'NpJIX6C+UKmV3GluCZvpUh77dZetKObutxSMw5YywAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026