UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PgHqR+aVzVHxqNVvlKkY6+rNKejkpIwwU4mAYfdvtO4='
WHERE
key_id = 'c65f90ebbb9376f8d96b2268d80991cd28b507814023d984b4c4af36d6c7f4b4'
AND (
token = 'PgHqR+aVzVHxqNVvlKkY6+rNKejkpIwwU4mAYfdvtO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)