UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qN9tB+p1ryzyiVWG5SZo2qBScCjlm8yl4UyOwzdfgK4='
WHERE
key_id = '81fbd20a916be566ee53f3033e8ebfebfb5f24062a27ec662620ec698659aaf6'
AND (
token = 'qN9tB+p1ryzyiVWG5SZo2qBScCjlm8yl4UyOwzdfgK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)