UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fo8Zh6MyxfFPsIkxfDsHNzrzW3T1uqEU8OVYwr+a1vc=' 
WHERE 
  key_id = '9dbc8b8786bee59fa491f29eed5e92926023f166704a52a18ff9c0e27e1c44b2' 
  AND (
    token = 'fo8Zh6MyxfFPsIkxfDsHNzrzW3T1uqEU8OVYwr+a1vc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019