UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0NQKJVG/r/ZiO9Hse9O7lAc7lcyJjQlbLruHySiBXi0='
WHERE
key_id = 'd11ee68d7ee00895e49d374ca300ffa2d358d90a40043e57afec914362ba09c9'
AND (
token = '0NQKJVG/r/ZiO9Hse9O7lAc7lcyJjQlbLruHySiBXi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)