UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J2pKVRxRXOM3fX+xIRxVFLHB1rL4rGBkqEET1JH1MNY='
WHERE
key_id = 'dd382f01f01d783bae4aa47c9cf1d0109dd3557785e225d116ccfe7a76220549'
AND (
token = 'J2pKVRxRXOM3fX+xIRxVFLHB1rL4rGBkqEET1JH1MNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)