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