UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '41dTb8DKzAxmBbUgrN8Jv2PQ1pCJpJgbA7pzWAQOqGw='
WHERE
key_id = 'd8e76d05b8c242b219ac1d3843584602eb17df0bb9b60a7dd08b68d456fed6e0'
AND (
token = '41dTb8DKzAxmBbUgrN8Jv2PQ1pCJpJgbA7pzWAQOqGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)