UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '286IN3lt7cMn1s6QrlhOIiJ8UKtxkm26jskgmRr7J/w='
WHERE
key_id = 'c59abf5c45ed29a9c535442b669ee9316e49d20342b1f529df0545e5293c4772'
AND (
token = '286IN3lt7cMn1s6QrlhOIiJ8UKtxkm26jskgmRr7J/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)