UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UPPGhXEZ3MBjntDvER6Ye1m10f6/yrDx5a+4jr1b8Ts=' 
WHERE 
  key_id = '3ce7473ddd8ee481eedfc7e58544b3f7050312ab5edd7db8070c2812f714dfb7' 
  AND (
    token = 'UPPGhXEZ3MBjntDvER6Ye1m10f6/yrDx5a+4jr1b8Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025