UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7Rhb/+fUZGq5fDLX1bTUXtd8BARgw8OiUD8W7remNI=' 
WHERE 
  key_id = '471539a0d3ca9e2f997a9cf64b424929a7cf757cd2c46d4697aeb867605d632f' 
  AND (
    token = 'f7Rhb/+fUZGq5fDLX1bTUXtd8BARgw8OiUD8W7remNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021