UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XBCdGEcjvr92CPvFtyQcUnOXQN/eoOw98xjJTwL9Il0=' 
WHERE 
  key_id = '3c24875217e3a0923ac05b64a86fc27bd439f6ebecdfec7381d6d8f63d962157' 
  AND (
    token = 'XBCdGEcjvr92CPvFtyQcUnOXQN/eoOw98xjJTwL9Il0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040