UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uGQf0eER8riO81BVYcQIlgGMQFSL8GrvtB62qVc0g6g='
WHERE
key_id = 'b8d1e698da485a2e23ae914369b117f1dc247aa7638d2ae1fe9e1315b8782008'
AND (
token = 'uGQf0eER8riO81BVYcQIlgGMQFSL8GrvtB62qVc0g6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)