UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyTTuC4sHvBwG+uYsrxrRuAgKoa2P85l9dCdmDQP4eM=' 
WHERE 
  key_id = '38218d2c1ec162257838a4ea2c03c910cab56d1c3b5e30c74c4e071704bd19f1' 
  AND (
    token = 'gyTTuC4sHvBwG+uYsrxrRuAgKoa2P85l9dCdmDQP4eM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047