UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TrdXyC5jONL5hy2qWnDOfeeSpxIcSCDigw/4vUKZnRs='
WHERE
key_id = '9a36583befc7e3cecc7ffdc4110c09398399844c3d906f62510de77174b641a9'
AND (
token = 'TrdXyC5jONL5hy2qWnDOfeeSpxIcSCDigw/4vUKZnRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)