UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TNr8pq+H45DEL14o3Li8pjqtgnoXVH8dzrvtKjVj7pM='
WHERE
key_id = 'de34584d1a64ac74f563bcae4e75e6d2ea22f266a77c85d5f181fc3fc0cc2652'
AND (
token = 'TNr8pq+H45DEL14o3Li8pjqtgnoXVH8dzrvtKjVj7pM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)