UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rV0XWuRfMtTND5KDIzC63u5iBQHddyPlnL9k4CeuHvc='
WHERE
key_id = '312e9863fb1265edb2e13bdd0143d286560042197f6e25024fe3ccbb18aeeccb'
AND (
token = 'rV0XWuRfMtTND5KDIzC63u5iBQHddyPlnL9k4CeuHvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)