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

Query time 0.00033