UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ldRlcSXCeaqenWxFnZNNxQT3Jw13sWAhFdDnUTiCrx4='
WHERE
key_id = '355cdf2b12a270454b03f0be91ce2d833d0b1f1755671d6720fd45b722f3329b'
AND (
token = 'ldRlcSXCeaqenWxFnZNNxQT3Jw13sWAhFdDnUTiCrx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)