UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HmTrKaVCPOudxj1eLylWWbcsKgZmsR2ubpYZSR9lBPU='
WHERE
key_id = 'af95412cf114d272be6c49c6bfa7d655528ecb1b085909a22e55118bce4663ce'
AND (
token = 'HmTrKaVCPOudxj1eLylWWbcsKgZmsR2ubpYZSR9lBPU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)