UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2x+loHKHbIBG0KWjSjUgnyfkwZh4wR3GTj/dg+t6oCo='
WHERE
key_id = '36313135f69729f78621dd6e4ce47524a23f651b5216961b2c4a6655fd457dbc'
AND (
token = '2x+loHKHbIBG0KWjSjUgnyfkwZh4wR3GTj/dg+t6oCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)