UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zxmASRzdTK4nghiG1C6If/IVjhqCyLZ9wZS461VgvHY='
WHERE
key_id = 'f8d49ef38f6d967ff3629059f6e03537035e74142c2afb42d4dfabb8f2fcd36d'
AND (
token = 'zxmASRzdTK4nghiG1C6If/IVjhqCyLZ9wZS461VgvHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)