UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wct/KdsWlxoMTN3teEc8unNYlkPB2CeAUiYNAZUrw+w='
WHERE
key_id = '239df8ae84f92d8a64ac6833257a718165f8b14156a8ae30ea29ef77d026aad7'
AND (
token = 'Wct/KdsWlxoMTN3teEc8unNYlkPB2CeAUiYNAZUrw+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)