UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bMd0Fy+y1hJvoXC029GYOt76uMq0sLoWjZQlpfH80j4='
WHERE
key_id = '17fa04181cafff7f1a21ff2fa250bc725e57bac9b91884a5e4b2939f731e37c4'
AND (
token = 'bMd0Fy+y1hJvoXC029GYOt76uMq0sLoWjZQlpfH80j4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)