UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HHlzTg5JZ2+iLAZhyVglCMWpddV35VNxch7w9jl3FmQ='
WHERE
key_id = 'deaf59ea1cb81e33df667bb8b7055c1500722e0cc8e55e2ff0d1d2387f0993ac'
AND (
token = 'HHlzTg5JZ2+iLAZhyVglCMWpddV35VNxch7w9jl3FmQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)