UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QDJzYjqELeaA41pZzsmU90TORVC9jULnnjbKvkwuXwM='
WHERE
key_id = '18724931733ea0fce4cbc6e0cb28f86787460dfae6d15b13d686c6e99ef8187d'
AND (
token = 'QDJzYjqELeaA41pZzsmU90TORVC9jULnnjbKvkwuXwM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)