UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3nOz9m0qiLpqjnmMtjnI0nhwv5K2c3HOfuCGlirs1ho='
WHERE
key_id = 'f377a56f3184fbe5719f42b227637e81fd88e0da1ed21e54f5e306f66eaf0754'
AND (
token = '3nOz9m0qiLpqjnmMtjnI0nhwv5K2c3HOfuCGlirs1ho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)