UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C8q/oTWRXVXIqMjzmTtjAbLr8O9i3rhB3FJ+uCZJk2k='
WHERE
key_id = 'ac6834be5e0d8413667cce9260b860dee7b9d3e5a59258176800d43bc238bde3'
AND (
token = 'C8q/oTWRXVXIqMjzmTtjAbLr8O9i3rhB3FJ+uCZJk2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)