UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/iKZDkyZIqO48K1eeegeVS2L9GERx90sRn/G8s63dC8='
WHERE
key_id = '15470842694cb58b46c6e48b9c580cc778ce2285686ffa7d47552ac799453022'
AND (
token = '/iKZDkyZIqO48K1eeegeVS2L9GERx90sRn/G8s63dC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)