UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0IYo+DLKZmqzwm1aVEFJ5wqZDEnCq+dCsrjIcAbEsO8=' 
WHERE 
  key_id = '1781b98bdb4184b0433311f803d3790f0056b87731976337f971ff1d52ed036e' 
  AND (
    token = '0IYo+DLKZmqzwm1aVEFJ5wqZDEnCq+dCsrjIcAbEsO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028