UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '46pJa8tRHpFxuGWkeKEwAXQ4NVk0Ig7+vhcFD2eb87Q='
WHERE
key_id = 'be7fede6947a0a3ca60af98c6438ef3ba47ae8227d9b62d2ce2cf0b808077bc4'
AND (
token = '46pJa8tRHpFxuGWkeKEwAXQ4NVk0Ig7+vhcFD2eb87Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)