UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p+qQ/FCZbUdF2OLB7tagcSCH5+ywyI1kuSAoUwz7xNU='
WHERE
key_id = 'd40e489ae0967c7000d9cf87d1e6aed1443bdef242098d0250c05cb137e9e902'
AND (
token = 'p+qQ/FCZbUdF2OLB7tagcSCH5+ywyI1kuSAoUwz7xNU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)