UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q2BkmD9UJRfBBgK0ILY46o1w+Ojxp+MvOLPjuGUxyH0='
WHERE
key_id = '46e0d38239f1a73c4f7297562312375f9dd56767780472ad600f0cc0eabbe38b'
AND (
token = 'q2BkmD9UJRfBBgK0ILY46o1w+Ojxp+MvOLPjuGUxyH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)