UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MhoaIBeVmFz783AkwJhwUfX0e1bQ62+ZL07ycKPOURI=' 
WHERE 
  key_id = '2c7dd2b416e67c026209e22ae4179103db238dc01fd31e4cd9044e63aad4b95f' 
  AND (
    token = 'MhoaIBeVmFz783AkwJhwUfX0e1bQ62+ZL07ycKPOURI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076