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