UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+2eYSSfRV+T5r25CarRXEGpzGNqTIUe6qbmNShH5igM=' 
WHERE 
  key_id = '271281778667bcdd31b6fd3710fafe7548b8611d853985683bda4662648831de' 
  AND (
    token = '+2eYSSfRV+T5r25CarRXEGpzGNqTIUe6qbmNShH5igM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031