UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lohey9QK0OvGuW97C9hvdN3dtEmIUpP1WBGeWobi8iU='
WHERE
key_id = '5cf8c6941df496cb9122b34c1de3220590d657780b26e8da0ce70c7002a170d4'
AND (
token = 'lohey9QK0OvGuW97C9hvdN3dtEmIUpP1WBGeWobi8iU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)