UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6Gi5d/EYb4QWGTVey3AxyVYxyNWX6TecQp5Yochz3s='
WHERE
key_id = 'e0beaec34d47756da423cc42ebdce9d6ed39ee2704c9efc016a3b24dd3c19ab8'
AND (
token = 'P6Gi5d/EYb4QWGTVey3AxyVYxyNWX6TecQp5Yochz3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)