UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q0O4pRFdlD2DcdcnkqT6mw+e1LlDYGXfi/MQInT2N1k=' 
WHERE 
  key_id = '1f8ad5b9412c9d8795e243bd8b1e33a789373f43d1a81e5339cb7aee0a674bb3' 
  AND (
    token = 'q0O4pRFdlD2DcdcnkqT6mw+e1LlDYGXfi/MQInT2N1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017