UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IP8qJ1xCi8grc9baAh+MhcFrOraqIgw0+PBwfJSneCI='
WHERE
key_id = 'a34cf046a6082063427e376c6b60d854f86939197d120c1ec297f1c1ca8e4947'
AND (
token = 'IP8qJ1xCi8grc9baAh+MhcFrOraqIgw0+PBwfJSneCI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)