UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YjFRAHa/VpaUHsVX4qb0CQ+yD5Bfunzme72WYI7n0gk='
WHERE
key_id = '9e51c736768f642b8e6947998af821f600ffd1365e7b496730157abfe9863b16'
AND (
token = 'YjFRAHa/VpaUHsVX4qb0CQ+yD5Bfunzme72WYI7n0gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)