UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4PckBaI4tL7NHcArYNboBfe7eflIC3MzrAvFisYNvug='
WHERE
key_id = '4d1a76cdc7dc7f43b2710e69a993c5f311895b08b5202df17c95bfb46b9db543'
AND (
token = '4PckBaI4tL7NHcArYNboBfe7eflIC3MzrAvFisYNvug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)