UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QakbC20NBFQpTbWKrgGPCbdzh3191cLZ4/BqkHCS7Fk='
WHERE
key_id = '8dedf261f52b2f9ced045d295bc4bf65e4a7bb4f6c740e828cdd2b74ba4e473a'
AND (
token = 'QakbC20NBFQpTbWKrgGPCbdzh3191cLZ4/BqkHCS7Fk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)