UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5RfgRah4BCY3LI7S0wVyC3wCumdiMoivsAs220uyM4w='
WHERE
key_id = 'c5dbfd4514fa1b3c8576b321c134b17bb9d08b2885b45fd7025f1e9217fc7ed1'
AND (
token = '5RfgRah4BCY3LI7S0wVyC3wCumdiMoivsAs220uyM4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)