UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bEtnt8cmDS67UNY7WjzXHcUTtrPVOZhIfldmujtMpdI='
WHERE
key_id = '340c51da30a73a38219bd966258bfbe887fab6bf6174ef364a1f7c12df94b10d'
AND (
token = 'bEtnt8cmDS67UNY7WjzXHcUTtrPVOZhIfldmujtMpdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)