UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtJoAq4SBEtDLv0071mHkRH6J65G8OAZzXULG8KkXck='
WHERE
key_id = '65c4bc47f4ccff1edf7e804fde0754a0b877864f50d48d6046285329a2c0a3da'
AND (
token = 'YtJoAq4SBEtDLv0071mHkRH6J65G8OAZzXULG8KkXck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)